//
//  cellViewModel.m
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/4/13.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import "CellViewModel.h"

@implementation CellViewModel


-(void)applyHandlercomplete:(void (^)(BOOL))complete{
    NSLog(@"掉接口申请");
    if (complete) {
        complete(YES);
    }
    self.model.index = 11;
}

-(void)jumpHandler{
    
    NSLog(@"掉接口跳转");
    if (self.actionHandle) {
        self.actionHandle(0);
    }
    
}


-(void)uploadPhotoComplete:(void (^)(void))complete{
    if (self.model.isUploading) {
        return;
    }
    if (self.model.isFinished) {
        return;
    }
    
    dispatch_async(self.queue, ^{
        for (NSInteger i = 0; i<100; i++) {
            NSLog(@"%ld————%@",i,[NSThread currentThread]);
        }
       
        if (complete) {
            dispatch_async(dispatch_get_main_queue(), ^{
                self.model.isFinished = YES;
                self.model.isUploading = NO;
                complete();
            });
        }
    });
}


-(void)dealloc{
    NSLog(@"-----%@--------",NSStringFromClass([self class]));
}

@end
